<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>16-求任意两个数之间的和</title>
	</head>
	<body>
		<script type="text/javascript">
			//求这1-50  30-77 ...节点的和
			var sum1=0,sum2=0;
			//循环
			for(var i=1;i<=50;i++){
				sum1+=i;
			}
			for(var j =30;j<=77;j++){
				sum2+=j;
			}
			console.log(sum1);
			console.log(sum2);
			
			//目的不是无限制写循环，要重复调用
			function total(start,end){
				var sum = 0;
				for(var i=start;i<=end;i++){
					sum +=i;
				}
				console.log(sum);
			}
			//调用才生效
			total(99,120);
		</script>
	</body>
</html>
